#include "TorusParser.h"


TorusParser::TorusParser(void)
{
}


TorusParser::~TorusParser(void)
{
}

TorusParser::TorusParser(float inner, float outer, int slices, int loops, string tx_id, string mat_id): PrimitiveParser(tx_id, mat_id)
{
	this->inner = inner;
	this->outer = outer;
	this->slices = slices;
	this->loops = loops;
}

void TorusParser::render(){
	if(texture_id != "none" && texture_id != "inherit")
		render(texture);
	else{
		glutSolidTorus(inner,outer,slices,loops);
	}
}

void TorusParser::render(TextureParser*  tx){
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, tx->tx_id);
	glutSolidTorus(inner,outer,slices,loops);
	glDisable(GL_TEXTURE_2D);
}